#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QFileDialog>
#include <QFileInfo>
#include <QImage>
#include <QLabel>
#include <QTextCodec>
#include <QMessageBox>
#include <QHBoxLayout>
#include <QScrollArea>
#include "Image.h"
#include<qimage.h>
#include<QMouseEvent>
#include<QWheelEvent>

#define cancel_quantity 40//可撤销图像的操作数

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE


class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void Cancel_Image();//撤销功能

    static int click_width;//记录鼠标点击的位置
    static int click_height;
    static int release_width;//记录鼠标释放的位置
    static int release_height;
    static int valve;//用来控制画笔的撤回功能

    //鼠标滚轮
    void wheelEvent(QWheelEvent *ev);
    //鼠标移动
    void mouseMoveEvent(QMouseEvent *ev);

private slots:

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_actionopen_2_triggered();

    void on_actionsave_2_triggered();



    void on_pushButton_clicked();

    void on_pushButton_5_clicked();

    void on_pushButton_6_clicked();

    void on_pushButton_7_clicked();

    void on_pushButton_8_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_11_clicked();

    void on_pushButton_9_clicked();

    void on_pushButton_10_clicked();

    void on_pushButton_12_clicked();

    void on_pushButton_13_clicked();

    void on_pushButton_14_clicked();

    void on_pushButton_15_clicked();

    void on_pushButton_16_clicked();

    void on_pushButton_17_clicked();

    void on_pushButton_18_clicked();

    void on_pushButton_19_clicked();

    void on_pushButton_20_clicked();

    void on_pushButton_21_clicked();

    void on_pushButton_22_clicked();

    void on_pushButton_23_clicked();

private:
    Ui::MainWindow *ui;
    unsigned char *mydata;
    Image myimg;
    Image myimg_2;
    double multiple = 1;//缩放倍数

     QImage* img=new QImage;

     int sharpen_valve = 0;//阀门，用来控制撤销功能
     Image sharpen_myimg;
     int sharpenre_valve = 0;
     Image sharpenre_myimg;
     int Grey_scale_valve = 0;
     Image Grey_scale_myimg;

     Image cancel_arr[cancel_quantity];//另一套撤销功能
     int cancel_head=0;//记录最新图像保存在哪个位置
     int cancel_tail=0;//记录最旧的图像位置
     int cancel_p = 0;//记录此时显示的图像位置

     int Arbitrary_scaling_valve = 0;//控制缩放功能

     int paintbrush_valve = 0;//控制画笔功能
     int paintbrush_size = 0;//画笔粗细
     unsigned char paintbrush_R = 0;//画笔颜色
     unsigned char paintbrush_B = 0;
     unsigned char paintbrush_G = 0;
};

#endif // MAINWINDOW_H
